package com.ocom.company.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ocom.common.entity.human.EntityResourceMenu;
import com.ocom.company.dao.IDaoResourceMenu;
import com.ocom.company.service.ResourceMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class ResourceMenuServiceImpl extends ServiceImpl<IDaoResourceMenu, EntityResourceMenu> implements ResourceMenuService {

    @Autowired
    private IDaoResourceMenu iDaoResourceMenu;

    @Override
    public List<EntityResourceMenu> getMenuList(Integer saasNo, Integer role) {
        QueryWrapper<EntityResourceMenu> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("saas_no",saasNo);
        queryWrapper.eq("status",1);
        if(role<=10000){
            queryWrapper.eq("if_custom",0);
        }
        queryWrapper.orderByAsc("parent_id","sort");
        return iDaoResourceMenu.selectList(queryWrapper);
    }

}
